#ifndef __STORMWIDGET_STORMWIDGET_UILIBRARY_CCONTAINERUI_CCONTAINERUI_H
#define __STORMWIDGET_STORMWIDGET_UILIBRARY_CCONTAINERUI_CCONTAINERUI_H

#include "ControlUI.h"

class IContainerUI
{
public:
	virtual CControlUI* GetItem(int iIndex) const = 0;
	virtual int GetCount() const = 0;
	virtual bool Add(CControlUI* pControl) = 0;
	virtual bool Remove(CControlUI* pControl) = 0;
	virtual void RemoveAll() = 0;
};


class CContainerUI : public CControlUI,public IContainerUI
{
public:
	CContainerUI(void);
	virtual ~CContainerUI(void);
public:
	LPCTSTR GetClass() const;
	LPVOID GetInterface(LPCTSTR pstrName);
	CControlUI* GetItem(int iIndex) const;
	int GetCount() const;
	bool Add(CControlUI* pControl);
	bool Remove(CControlUI* pControl);
	void RemoveAll();
	void Event(TEventUI& event);
	void SetVisible(bool bVisible);
	void SetPos(RECT rc);
	SIZE EstimateSize(SIZE szAvailable);
	void DoPaint(HDC hDC, const RECT& rcPaint);
	void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
	void SetManager(CPaintManagerUI* pManager, CControlUI* pParent);
	CControlUI* FindControl(FINDCONTROLPROC Proc, LPVOID pData, UINT uFlags);

public:
	virtual void SetInset(SIZE szInset);
	virtual void SetInset(RECT rcInset);
	virtual void SetPadding(int iPadding);
	virtual void SetWidth(int cx);
	virtual void SetHeight(int cy);
	virtual void SetAutoDestroy(bool bAuto);
	virtual int FindSelectable(int iIndex, bool bForward /* = true */) const;
	virtual int GetScrollPos() const;
	virtual int GetScrollPage() const;
	virtual SIZE GetScrollRange() const;
	virtual void SetScrollPos(int iPos);
	virtual void EnableScrollBar(bool bEnable);

protected:
	virtual void ProcessScrollbar(RECT rc, int cyRequired);
protected:
	CStdPtrArray m_items;
	RECT m_rcInset;
	int m_iPadding;
	SIZE m_cxyFixed;
	bool m_bAutoDestroy;
	bool m_bAllowScrollbars;
	HWND m_hwndScroll;
	int m_iScrollPos;
	int m_iScrollPage;

};
#endif //__STORMWIDGET_STORMWIDGET_UILIBRARY_CCONTAINERUI_CCONTAINERUI_H